package com.erlang.springmvc.controller;

import com.erlang.springmvc.pojo.Customer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * @Description：
 */
@Controller
@RequestMapping("customer")
public class CustomerController {

    @RequestMapping("to-login")
    public String toLogin(){
        return "to-login";
    }


    @RequestMapping("login")
    public String login(Customer customer, HttpSession session){
        if (!"".equals(customer.getLoginName())&&!"".equals(customer.getPassword())){
            session.setAttribute("customer", customer.getLoginName());
        }
        return "redirect:/up-load/to-add";
    }
}